import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.net.UnknownHostException;

public class Principal {
	private static String host = "localhost";
	private static int port = 4000;
	
	public static void main(String[] args){
		String mensajeUsuario;
		String mensajeServidor;
		String str = "";
		
		try {
			
			BufferedReader teclado = new BufferedReader(new InputStreamReader(System.in));
			
			Socket socket = new Socket(host, port);
			BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
			DataOutputStream salida = new DataOutputStream(socket.getOutputStream());
			
			mensajeUsuario = teclado.readLine();
			salida.writeUTF(mensajeUsuario);
			ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());

			ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());

			 
			//	Clientes cli = new Clientes();
			//	cli = (Clientes) ois.readObject();
				Object o = ois.readObject();
			    //System.out.println(cli.getApellido());
			 
			 
	//		mensajeServidor = reader.readLine();
					
//			System.out.println(mensajeServidor);
			ois.close();
			oos.close();
			socket.close();
			
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}